﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using CloudWars.Animation;

namespace CloudWars.Units
{
    public class Infantry : Unit
    {
        public override string Title
        {
            get
            {
                return "Infantry";
            }
        }
        public override float MaxHP
        {
            get
            {
                return 100;
            }
        }
        public override int MaxMove
        {
            get
            {
                return 3;
            }
        }
        public override int AttackPower
        {
            get
            {
                return 20;
            }
        }
        public override int AttackRange
        {
            get
            {
                return 2;
            }
        }

        private static Texture2D unitTexture;
        private static SpriteAnimation moveAnimation;
        private static SpriteAnimation attackAnimation;

        public override Texture2D UnitTexture
        {
            get
            {
                return unitTexture;
            }
        }
        public override SpriteAnimation MoveAnimation
        {
            get
            {
                return moveAnimation;
            }
        }
        public override SpriteAnimation AttackAnimation
        {
            get
            {
                return attackAnimation;
            }
        }

        public new static void LoadTextures(ContentManager contentManager)
        {
            unitTexture = contentManager.Load<Texture2D>("soldier");
            moveAnimation = new SpriteAnimation(contentManager.Load<Texture2D>("infantry_move_sprite"), 6);
            moveAnimation.Position = new Vector2(50, 50);
            moveAnimation.IsLooping = true;
            moveAnimation.FramesPerSecond = 10;

            attackAnimation = new SpriteAnimation(contentManager.Load<Texture2D>("infantry_attack_sprite"), 10);
            attackAnimation.Position = new Vector2(50, 50);
            attackAnimation.IsLooping = false;
            attackAnimation.FramesPerSecond = 12;
        }

        public Infantry(Player owner, string name, int x, int y, OnUnitDeathDelegate onDeath)
            : base(owner, name, x, y, onDeath)
        {
        }
    }
}
